#!/usr/bin/env node
const { program } = require("commander");

program.version("0.0.1", "-v, --version", "查看版本号");
program
  .command("create [subject-name]")
  .description("创建新专题")
  .action((name) => {
    require("./commands/create")(name);
  });
program
  .command("ip")
  .description("读取系统ip及对应mac地址")
  .option("-f, --family <family>", "读取IPv4/IPv6相关内容", "ipv4")
  .action((options) => {
    require("./commands/osinfo")(options);
  });
program
  .command("open")
  .description("使用vscode打开文件/文件夹")
  .option("-s, --select [dir]", "从已有配置中选择项目，并在新窗口中打开")
  .option("-f, --file <file>", "使用vscode在当前窗口中打开文件")
  .action((options) => {
    require("./commands/open")(options);
  });
program
  .command("pull")
  .description("git 同步远程仓库，默认同步所有仓库")
  .option("-s, --select [dir]", "选择指定目录同步")
  .action((option) => {
    require("./commands/pull")(option);
  });
program
  .command("reload <app-name>")
  .description("重启应用")
  .action((name) => {
    require("./commands/reload")(name);
  });
program
  .command("start <app-name>")
  .description("启动应用程序")
  .action((name) => {
    require("./commands/start")(name);
  });
program
  .command("stop <app-name>")
  .description("停止应用程序")
  .action((name) => {
    require("./commands/stop")(name);
  });
program.parse();
